package BehavioralMode.strategy.zombie.zombie;

import BehavioralMode.strategy.zombie.attack.Attack;
import BehavioralMode.strategy.zombie.attack.AttackStrike;
import BehavioralMode.strategy.zombie.move.Move;
import BehavioralMode.strategy.zombie.move.MoveCrawl;
import BehavioralMode.strategy.zombie.move.MoveWalk;

/**
 * 环境类
 * */
public class Zombie {
     private String zombieType;
     private String name;
     private Attack attack;
     private Move move;

    public Zombie(String zombieType, String name) {
        this.zombieType = zombieType;
        this.name = name;

         // 根据不同类型僵尸 自动加载攻击方式交恶
        if(this.zombieType == ZombieType.COMMON_ZOMBIE.getType()){
              this.attack = new AttackStrike();
              this.move = new MoveWalk();
        }

        if(this.zombieType == ZombieType.CRAWL_ZOMBIE.getType()){
             this.attack = new AttackStrike();
             this.move = new MoveCrawl();
        }

    }

    public void setMove(Move move) {
        this.move = move;
    }

    public void setAttack(Attack attack) {
        this.attack = attack;
    }

    public void attack(){
         attack.attack();
     }

     public void move(){
         move.move();
     }



}
